<?php
namespace Home\Controller;
use Think\Controller;
class GoodsController extends Controller{
    public function cat(){
        $goods = D('Admin/Model/Goods');
        $cate = D('Admin/Model/Cat');
        //产品分类
        $catlist = $cate->field('cat_id,cat_name,parent_id')->select();
        $alist = catList($catlist);
        $this->assign('alist',$alist);

        //根据接收的cat_id获取商品
        $cat_id = I('cat_id');
        $goodsdata = $goods->where(['cat_id'=>$cat_id])->order('goods_id desc')->select();
        $this->assign('goodsdata',$goodsdata);

        $this->display();
    }

    public function goods(){
        $this->display();
    }
}
?>
